package com.codeoss.module.stock.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.codeoss.framework.service.impl.BaseService;
import com.codeoss.module.stock.dao.StockLocatorMapper;
import com.codeoss.module.stock.model.StockLocator;
import com.codeoss.module.stock.service.IStockLocatorService;

@Service
public class StockLocatorService extends BaseService<StockLocatorMapper, StockLocator> implements IStockLocatorService {

	@Override
	public StockLocator getDefaultLocator(Long stockWarehouseId) {
		// TODO Auto-generated method stub
		QueryWrapper<StockLocator> query=new QueryWrapper<StockLocator>();
		query.eq("stock_warehouse_id", stockWarehouseId);
		query.eq("default_locator","1");
		List<StockLocator> stockLocatorList=list(query);
		if(stockLocatorList.size()>0) {
			return stockLocatorList.get(0);
		}
		return null;
	}
}